package com.example.sicnuaccountingapp.data.repository

import com.example.sicnuaccountingapp.data.dao.BudgetDao
import com.example.sicnuaccountingapp.data.entity.Budget
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

class BudgetRepository @Inject constructor(
    private val budgetDao: BudgetDao
) {
    suspend fun addBudget(budget: Budget): Long {
        return budgetDao.insert(budget)
    }

    suspend fun updateBudget(budget: Budget) {
        budgetDao.update(budget)
    }

    suspend fun deleteBudget(budget: Budget) {
        budgetDao.delete(budget)
    }

    fun getAllBudgets(userId: Long): Flow<List<Budget>> {
        return budgetDao.getAllBudgets(userId)
    }

    fun getActiveBudgets(userId: Long): Flow<List<Budget>> {
        return budgetDao.getActiveBudgets(userId)
    }
} 